package org.example.route.service.impl;

import org.example.route.constant.OrderConstant;
import org.example.route.mapper.OrderMapper;
import org.example.route.mapper.ShoppingMapper;
import org.example.route.model.vo.OrderShowVO;
import org.example.route.model.vo.ShoppingShowVO;
import org.example.route.service.OrderService;
import org.example.route.service.ShoppingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class ShoppingServiceImpl implements ShoppingService

{
    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private ShoppingMapper shoppingMapper;
    @Autowired
    private OrderService orderService;


    @Override
    public List<ShoppingShowVO> list(Long userId)
    {
      List<ShoppingShowVO> shoppingShowVOS = new ArrayList<>();
      List <OrderShowVO> orderShowVOS = orderService.list();
      //收集到还没有支付的账号放在购物车中
      for (OrderShowVO orderShowVO : orderShowVOS)
      {
          if (orderShowVO.getStatus().equals(OrderConstant.WAIT_PAY))
          {
             // ShoppingShowVO shoppingShowVO = new ShoppingShowVO(orderShowVO.getId(),orderShowVO.getGoId1(),orderShowVO.getGoId2(),orderShowVO.getThePrice(),orderShowVO.getGrade(),orderShowVO.getCount(),orderShowVO.getByUser(),orderShowVO.getLastCount(),orderShowVO.getGoName1(),orderShowVO.getGoName2(),orderShowVO.getGradeName(),orderShowVO.getStartTime(),orderShowVO.getEndTime(),orderShowVO.getStatus(),orderShowVO.getSeatName());
             // shoppingShowVOS.add(shoppingShowVO);
          }
      }
      return shoppingShowVOS;









    }
}
